#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
// priority_queue<int, vector<int>, less<int>> pq;

void solve() {
    int n, k, p;
    cin >> n >> k >> p;
    int t = abs(k);
    int x = (t + p - 1) / p;
    if(x > n) {
        cout << -1 << endl;
    }else{
        cout << x << endl;
    }
}

signed main() {
    int t; cin >> t;
    while(t--) solve();
    return 0;
}